# -*- coding: utf-8 -*-
"""
@Time ： 2024/4/19 13:21
@Auth ： 李天天
"""
import time

from PagePoints.page_point_for_sec import PointForSec as p
from Common.connect_to_device import d_one_device


class ClickPointForSec:
    def __init__(self):
        self.device = d_one_device

    def start_CPdemo_app(self):
        if "u10 com.arcvideo.totalmedia.cpuidemo.IQIYI" in self.device.shell("dumpsys window | grep mCurrentFocus"):
            pass
        else:
            self.device.shell(
                "am start --user 10 --display 1 com.arcvideo.totalmedia.cpuidemo.IQIYI/com.arcvideo.totalmedia.cpuidemo.MainActivity")

    def click_sec_point(self, x, y):
        self.device.shell(f"input -d 1 tap {x} {y}")

    def click_start_share_point(self):
        self.click_sec_point(*p.start_share_point)

    def click_first_screen_point(self):
        self.click_sec_point(*p.first_screen_point)

    def click_sec_screen_point(self):
        self.click_sec_point(*p.sec_screen_point)

    def click_third_screen_point(self):
        self.click_sec_point(*p.third_screen_point)

    def click_fourth_screen_point(self):
        self.click_sec_point(*p.fourth_screen_point)

    def click_ok_point(self):
        self.click_sec_point(*p.ok_point)

    def click_back_point(self):
        self.click_sec_point(*p.back_point)


if __name__ == '__main__':
    # ClickPointForSec().click_start_share_point()
    # time.sleep(1)
    # ClickPointForSec().click_first_screen_point()
    # time.sleep(0.5)
    # ClickPointForSec().click_third_screen_point()
    # time.sleep(0.5)
    # ClickPointForSec().click_fourth_screen_point()
    # time.sleep(0.5)
    # ClickPointForSec().start_CPdemo_app()
    # res=d_one_device.app_current().package
    # res = d_one_device.shell("dumpsys window | grep mCurrentFocus")
    # print(res)
    ClickPointForSec().start_CPdemo_app()
